package com.sunyard.dal.mapper;


import com.sunyard.dal.bo.org.OrganizationQueryBO;
import com.sunyard.dal.bo.org.SysPermissionBo;
import com.sunyard.dal.bo.warning.WarningInfoQueryBO;
import com.sunyard.dal.dto.OrgTreeDTO;
import com.sunyard.dal.dto.OrganizationDTO;
import com.sunyard.dal.dto.WarningInfoDTO;
import com.sunyard.dal.entity.Organization;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface OrganizationMapper {

    /**
     * @Description: 根据机构ID查询机构详细信息
     * @Author: jiy.fang
     * @Date: 2019/7/22 17:18
     */
    Organization getOrganizationByOrgId(@Param("orgId") String orgId);

    /**
     * @Description: 查询子机构ID列表
     * @Author: jiy.fang
     * @Date: 2019/7/19 15:23
     */
    List<Organization> getOrgIdsListByOrgIdAndOrgLevel(@Param("orgId") String orgId, @Param("orgLevel") Integer orgLevel);

    List<String> getOrgIdsList(@Param("orgId") String orgId);

    /**
     * @Description: 根据子机构列表查询机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/19 16:38
     */
    List<OrganizationDTO> getListOrganizationDTOByPage(Map<String, Object> map);

    Integer CountByOrgName(String orgName);

    Integer getCountByOrgId(String orgId);

    /**
     * @Description: 根据机构ids获取机构名
     * @Author: jiy.fang
     * @Date: 2019/7/22 23:09
     */
    List<Organization> getListOrganization(List<String> list);

    /**
     * @Description: 根据机构id获取本机构及子机构
     * @Author: zih.sun
     * @Date: 2021/03/29 11:13
     */
    List<Organization> getOrgAndAllSonOrgs(@Param("list") List<String> orgId);

    /**
     * @Description: 根据机构id获取本机构及子机构
     * @Author: zih.sun
     * @Date: 2021/03/29 11:13
     */
    List<Organization> getSonOrgs(String orgId,Integer level);

    /**
     * @Description: 根据机构id获取所有子机构
     * @Author: zih.sun
     * @Date: 2021/03/29 14:25
     */
//    List<String> getAllSonOrgIds(String orgId);

    /**
     * @Description: 条件查询机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/22 23:31
     */
    List<OrganizationDTO> getListOrganizationDTO(OrganizationQueryBO organizationQueryBO);

    /**
     * @Description: 根据机构ID获取子机构list
     * @Author: jiy.fang
     * @Date: 2019/7/24 14:26
     */
    List<Organization> getChildListOrgByOrgId(String orgId);

    List<Organization> getListByPid(String orgId);

    List<OrgTreeDTO> obtainOrgTree(String orgId);

    List<OrgTreeDTO> obtainOrg(String orgId);

    Integer getOrgLevelByOrgId(String orgId);

    /**
     * 通过机构号查询机构名称
     *
     * @param orgId
     * @return orgName
     */
    String getOrgName(@Param("orgId") String orgId);

    int updateOrgAuditType(SysPermissionBo sysPermissionBo);

    Integer insertOrg(Organization organization);

    Integer updateOrg(Organization organization);

    Integer deleteOrg(String orgId);

    /**
     * 查询预警信息
     *
     * @return
     */
    List<WarningInfoDTO> queryWarningInfo(WarningInfoQueryBO warningInfoQueryBO);

    //获取所有机构
    List<OrgTreeDTO> getAllOrg();

    //根据ID获取机构信息
    Organization getOrganizationById(Integer id);

    //获取省级下面的机构
    List<String> getOrgIdsByProCode(String proCode);

    //获取市级下面的机构
    List<String> getOrgIdsByCtCode(String ctCode);

    //获取区/县 下面的机构
    List<String> getOrgIdsByDisCode(String disCode);

}
